<include file="Public/header" />
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>经销商管理</h3>
      <ul class="tab-base">
        <li><a href="{:U('Agent/agent')}"><span>管理</span></a></li>
        <li><a href="JavaScript:void(0);" class="current"><span>新增</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form id="goods_form" method="post" name="goods_form" enctype="multipart/form-data">
  <input name="id" type="hidden" value="{$rs['id']}"/>
    <table class="table tb-type2 nobdb">
      <tbody>    
        <tr class="noborder">
          <td colspan="2" class="required"><label class="validation">微信昵称:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$rs['nick_name']}" name="nick_name" id="nick_name" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>

        <tr class="noborder">
          <td colspan="2" class="required"><label class="validation">真实姓名:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$rs['true_name']}" name="true_name" id="true_name" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>
        
         <tr class="noborder">
          <td colspan="2" class="required"><label class="validation">代理级别:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$rs['level_name']}" name="level_name" id="level_name" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>
        
         <tr class="noborder">
          <td colspan="2" class="required"><label class="validation">通讯地址:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$rs['address']}" name="address" id="address" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>                      
        
        <tr class="noborder">
          <td colspan="2" class="required"><label class="">微信ID:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$rs['wexin_id']}" name="wexin_id" id="wexin_id" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>                
        <tr>
          <td colspan="2" class="required"><label for="articleForm">头像信息:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"> <input type="file" id="agent_pic" name="agent_pic" size="30"></td>
          <td class="vatop tips">支持类型gif,jpg,jpeg,png</td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label for="articleForm">二维码:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"> <input type="file" id="agent_ewm" name="agent_ewm" size="30"></td>
          <td class="vatop tips">支持类型gif,jpg,jpeg,png</td>
        </tr>        
          <td colspan="2" class="required">排序: </td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$rs['agent_sort']}" name="agent_sort" id="agent_sort" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="15" ><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span>保存</span></a></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<script>
//按钮先执行验证再提交表单
$(function(){$("#submitBtn").click(function(){
    if($("#goods_form").valid()){
     $("#goods_form").submit();
	}
	});
});
//
$(document).ready(function(){
	$('#goods_form').validate({
        errorPlacement: function(error, element){
			error.appendTo(element.parent().parent().prev().find('td:first'));
        },
        success: function(label){
            label.addClass('valid');
        },
        rules : {
            nick_name : {
                required   : true
            },
			true_name : {
                required   : true
            },
			level_name : {
				required : true
            },
			address : {
				required : true
			},
			wexin_id : {
                required   : true
            },						
			agent_sort : {
				number : true
			}
        },
        messages : {
            nick_name : {
                required   : '请输入昵称'
            },
			true_name : {
                required   : '请输入真实姓名'
            },
			level_name : {
				required : '请输入代理级别'
            },
			address : {
				required : '请输入通信地址'
            },
			wexin_id : {
                required   : '请输入微信ID'
            },					
			agent_sort : {
				number : '排序格式输入错误'
            }
        }
    });
	
});
</script>
<include file="Public/footer" />